#ifndef __DOTFONT_H__
#define __DOTFONT_H__

#ifdef DOTFONT_EXPORTS
#define DOTFONT_API __declspec(dllexport)
#else
#define DOTFONT_API __declspec(dllimport)
#endif

#if defined WIN32_MEAN_AND_LEAN
#	pragma error("Undefine WIN32_MEAN_AND_LEAN coz DotFont uses Gdiplus")
#endif // WIN32_MEAN_AND_LEAN

//----------------------------------------------------------------------------//

namespace dotfont{

#include <GdiPlus.h>

using Gdiplus::Size;
using Gdiplus::PointF;
using Gdiplus::Color;

class PixelFormat
{
public:
	PixelFormat() 
		: pf(PixelFormat32bppARGB)
	{}

	PixelFormat(INT Pf)
		: pf(Pf)
	{}

	operator INT() const
	{
		return pf;
	}

	int size() const
		{ return Gdiplus::GetPixelFormatSize(pf); }

	enum{
		pf1bppIndexed		= PixelFormat1bppIndexed,
		pf4bppIndexed		= PixelFormat4bppIndexed,
		pf8bppIndexed		= PixelFormat8bppIndexed,
		pf16bppGrayScale	= PixelFormat16bppGrayScale,
		pf16bppRGB555		= PixelFormat16bppRGB555,
		pf16bppRGB565		= PixelFormat16bppRGB565,
		pf16bppARGB1555		= PixelFormat16bppARGB1555,
		pf24bppRGB			= PixelFormat24bppRGB,
		pf32bppRGB			= PixelFormat32bppRGB,
		pf32bppARGB			= PixelFormat32bppARGB,
		pf32bppPARGB		= PixelFormat32bppPARGB,
		pf48bppRGB			= PixelFormat48bppRGB,
		pf64bppARGB			= PixelFormat64bppARGB,
		pf64bppPARGB		= PixelFormat64bppPARGB,
		pf32bppCMYK			= PixelFormat32bppCMYK,
	};

private:
	INT pf;
};

class DOTFONT_API DotFont
{
public:

	enum Style{
		sRegular	= 0,
		sBold		= 1,
		sItalic		= 2,
		sBoldItalic	= 3,
		sUnderline	= 4,
		sStrike		= 8,
	};

	static DotFont* create();
	static void dispose(DotFont* pDF);

	virtual ~DotFont() {}

	static const int DEFAULT_N_ENTRY_ROW = 16;
	static const int DEFAULT_N_ENTRY_COLUMN = 16;

	virtual bool generate(const wchar_t* CharSet, const wchar_t* FontName, float FontSize, 
		Style S, const PixelFormat& pf, const Size& EntrySize, 
		const PointF& EntryOffset = PointF(-2, -2),
		int nEntryRow = DEFAULT_N_ENTRY_ROW, int nEntryColumn = DEFAULT_N_ENTRY_COLUMN,
		DWORD FontColor = Color::White, DWORD BgColor = Color::Black, bool Antialiase = true) = 0;

	virtual bool generateWithStroke( const wchar_t* CharSet, const wchar_t* FontName, float FontSize, 
		Style S, const PixelFormat& pf, const Size& EntrySize, DWORD StrokeColor,
		const PointF& EntryOffset = PointF(-2, -2),
		int nEntryRow = DEFAULT_N_ENTRY_ROW, int nEntryColumn = DEFAULT_N_ENTRY_COLUMN,
		DWORD FontColor = Color::White, DWORD BgColor = Color::Black, bool Antialiase = true) = 0;

	virtual void dump( bool ShowGrid = false, const wchar_t* Prefix = NULL, const wchar_t* Path = NULL) = 0;

	virtual const wchar_t* getError() = 0;
};

} // namespace dotfont


#endif // __DOTFONT_H__